package main

import (
	"os"

	"protection/user/docs"
	"protection/user/method"
	"protection/user/router"
	userapp "protection/user/user_app"
	userredis "protection/user/user_redis"

	myrpc "github.com/2217263633/kakarpc"
	"github.com/gin-gonic/gin"
)

func main() {
	var yaml myrpc.ServerStruct = myrpc.ServerStruct{
		Chinese_name: "用户服务",
		Name:         "UserService",
		Router: map[string]interface{}{
			"GetUser":    []string{"int", "User"},
			"ParseToken": []string{"token"},
		},
		Mode:      myrpc.Debug,
		Port:      1235,
		Swag_port: 1236,
	}
	yaml.Path, _ = os.Getwd()
	userredis.Connect()
	// 连接注册中心
	// 让注册中心给自己分配一个端口

	docs.SwaggerInfo.BasePath = "/" + yaml.Name
	gin.SetMode(gin.ReleaseMode)
	userapp.Rpc.R = router.Router()
	userapp.Rpc.Conn = new(method.UserService)
	myrpc.MyRpc.GoRpc(&yaml, &userapp.Rpc)
}
